SynchronizedLinkedList
Represents a thread-safe linked list that provides synchronization for its operations.
Implements: ISynchronizedCollection<T>, ISynchronizedCollection, ISynchronizable, ICollection<T>, IEnumerable<T>, IEnumerable
Properties
public int Count { get; }
value = synchronizedLinkedList.Count
Gets the number of nodes contained in the linked list.
public virtual LinkedListNode<T> First { get; }
value = synchronizedLinkedList.First
Gets the first node of the linked list.
public virtual LinkedListNode<T> Last { get; }
value = synchronizedLinkedList.Last
Gets the last node of the linked list.
public Lock SyncRoot { get; }
value = synchronizedLinkedList.SyncRoot
Gets the synchronization root object used to synchronize access to the linked list.
System#Collections#Generic#ICollection{T}#IsReadOnly
Gets a value indicating whether the linked list is read-only.
Methods
public virtual void AddBefore(LinkedListNode<T> node, T value)
synchronizedLinkedList.AddBefore(node, value)
Adds a new node containing the specified value before the specified existing node.
- node
- The node before which the new node should be added.
- value
- The value to add to the linked list.
public virtual void AddBefore(LinkedListNode<T> node, LinkedListNode<T> newNode)
synchronizedLinkedList.AddBefore(node, newNode)
Adds the specified new node before the specified existing node.
- node
- The node before which the new node should be added.
- newNode
- The new node to add.
public virtual void AddFirst(LinkedListNode<T> node)
synchronizedLinkedList.AddFirst(node)
Adds the specified new node at the start of the linked list.
- node
- The new node to add.
public virtual void AddFirst(T value)
synchronizedLinkedList.AddFirst(value)
Adds a new node containing the specified value at the start of the linked list.
- value
- The value to add to the linked list.
public virtual void AddLast(LinkedListNode<T> node)
synchronizedLinkedList.AddLast(node)
Adds the specified new node at the end of the linked list.
- node
- The new node to add.
public virtual void AddLast(T value)
synchronizedLinkedList.AddLast(value)
Adds a new node containing the specified value at the end of the linked list.
- value
- The value to add to the linked list.
public bool Contains(T item)
result = synchronizedLinkedList.Contains(item)
Determines whether the linked list contains the specified value.
- item
- The value to locate in the linked list.
Returns: true if the value is found in the linked list; otherwise, false.
public void CopyTo(T[] array, int arrayIndex)
synchronizedLinkedList.CopyTo(array, arrayIndex)
Copies the elements of the linked list to an array, starting at a particular array index.
- array
- The one-dimensional array that is the destination of the elements copied from the linked list.
- arrayIndex
- The zero-based index in at which copying begins.
public Scope EnterScope()
result = synchronizedLinkedList.EnterScope()
Enters a synchronized scope for thread-safe operations on the collection.
Returns: A Scope that represents the synchronized scope.
public virtual LinkedListNode<T> Find(T value)
result = synchronizedLinkedList.Find(value)
Finds the first node that contains the specified value.
- value
- The value to locate in the linked list.
Returns: The first node that contains the specified value, if found; otherwise, null.
public virtual LinkedListNode<T> FindLast(T value)
result = synchronizedLinkedList.FindLast(value)
Finds the last node that contains the specified value.
- value
- The value to locate in the linked list.
Returns: The last node that contains the specified value, if found; otherwise, null.
public IEnumerator<T> GetEnumerator()
result = synchronizedLinkedList.GetEnumerator()
Returns an enumerator that iterates through the linked list.
Returns: An enumerator that can be used to iterate through the linked list.
public virtual void Remove(LinkedListNode<T> node)
synchronizedLinkedList.Remove(node)
Removes the specified node from the linked list.
- node
- The node to remove.
public bool Remove(T item)
result = synchronizedLinkedList.Remove(item)
Removes the first occurrence of the specified value from the linked list.
- item
- The value to remove from the linked list.
Returns: true if the value was successfully removed; otherwise, false.
public virtual void RemoveFirst()
synchronizedLinkedList.RemoveFirst()
Removes the node at the start of the linked list.
public virtual void RemoveLast()
synchronizedLinkedList.RemoveLast()
Removes the node at the end of the linked list.
System#Collections#Generic#ICollection{T}#Add(T)
Adds an item to the linked list.
- item
- The item to add to the linked list.
System#Collections#IEnumerable#GetEnumerator()
Returns an enumerator that iterates through the linked list.
Returns: An enumerator that can be used to iterate through the linked list.